"""
def my_min(x,y):
    ret = x if x< y else y
    return ret

r = my_min(1,2)
print(r)
"""

# def func(x,y,z,l = None):
#     if l is None:
#         l = list()
#     l.append(x)
#     l.append(y)
#     l.append(z)
#     print(l)


# l = [1,2,3]
# func(1,2,3,l)

# def func(x,y,*z):
#     print(x,y,z)

# func(1,2,3,4)  # 多出的参数以元组的形式赋值给z,


# def add(*args):
#     sum = 0
#     for i in args:
#         sum += i
#     return sum


# ret = add(1,2,3,4,45)
# print(ret)


# def add2(**kwargs):
#     print(kwargs)


# add2(x = 1,y =2,z = 3,f = 99)


# def func(x,y,z):
#     print(x,y,z)


# ll = [11,22,33]
# func(*ll)




# def index(x,y,z):
#     print(x,y,z)

# def func(*args,**kwargs): # args = (1,)  kwargs = {'y':1,'z':2}
#     index(*args,**kwargs)


# func(1,y = 1,z = 2)



"""
1.位置参数
    形参-->def func(x,y,z)
    实参-->func(1,2,3) -->要求:必须为每一个参数都赋值
2.关键字参数
def func(x,y,z)
    实参-->func(x = 1,y = 2,z = 3)
3.默认参数
def func(z,y,z = 1)
func(1,2)
func(1,3,4)

4.可变长度的参数
    4.1 可变长度的位置参数

    -->形参的使用方法:
    def func(x,*args)
    func(1,2,3,4,54) -->x = 1, args = (2,3,4,54)

    -->实参的使用方法:
    ll = [1,2,3]
    func(*ll) #这个* 展开就是func(1,2,3)


    4.2 可变长度的关键字参数

    -->形参的使用方法:    
    def func(x,**kwargs)    

    func(1,x = 11,y = 22,z = 90) -->x = 1,kwargs = {'x':11,'y':22,'z':90}
    -->实参的使用方法:
    d = {'y':12,'z':11}
    func(*d) # *展开就是 func('y','z')
    func(**d) # **展开就是func('y' = 12,'z' = 11)


5.命名关键字参数
def register(name,age,**kwargs):
    if 'sex' in kwargs:
        # 有sex参数
        pass
    if 'height' in kwargs:
        # 有height参数
        pass






6.组合使用

"""

# import copy

# kvps = { '1' : 1, '2' : 2 }

# theCopy1 = kvps  # 和kvps变化一致
# theCopy2 = kvps.copy() # 这个相当于复制一份,原来的变化不影响复制后的
# theCopy3 = copy.copy(kvps)  # 浅拷贝,kvps内部对象变,theCopy3会跟着变;kvps指向别的对象,theCopy3不会发生变化
# theCopy4 = copy.deepcopy(kvps) #深拷贝

# kvps['1'] = 5
# kvps['2'] = 10

# print(theCopy1,theCopy2,theCopy3,theCopy4)

import copy

def printf(l = None):
    if l is None:
        l =list()
    print(type(l),l)



ll = [1,2,3,4]
l2 = ll.copy()
l3 = copy.copy(ll)

ll[1] = 111

printf(ll)
printf(l2)
printf(l3)

"""
<class 'list'> [1, 111, 3, 4]
<class 'list'> [1, 2, 3, 4]
<class 'list'> [1, 2, 3, 4]
"""